<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>sadf </title>
</head>
<body>

<script src="jquery.js"></script>
<script src="index.js"></script>

asdfasdfggggw我d ss

<div id="eee">sdfsdf</div>
<div id="mmm">sdfsdfdddddd</div>
<div id="ddf">sdfsdfdddddd</div>
<img   src=""   id="picture"  >

<button onclick="turnsend_picture()">ddddddddddddd</button>
<script>




    var image2='http://androidimg/storage/emulated/0/1.jpg';
    var image='http://huashengke.haoyv.cn:60001/public/g工作内容/123.png';
    function getBase64Image(url,callback){
        //通过构造函数来创建的 img 实例，在赋予 src 值后就会立刻下载图片，相比 createElement() 创建 <img> 省去了 append()，也就避免了文档冗余和污染
        var Img = new Image(),

            // Img.setAttribute("crossOrigin",'Anonymous');
            dataURL='';
        Img.src=url;
        Img.onload=function(){ //要先确保图片完整获取到，这是个异步事件
            var canvas = document.createElement("canvas"), //创建canvas元素
                width=Img.width, //确保canvas的尺寸和图片一样
                height=Img.height;
            canvas.width=width;
            canvas.height=height;

            document.getElementById("eee").innerText=height;
            canvas.getContext("2d").drawImage(Img,0,0,width,height); //将图片绘制到canvas中
            dataURL=canvas.toDataURL('image/jpg');
            document.getElementById("eee").innerText=height;
            callback?callback(dataURL):null; //调用回调函数
        };
    }

    // getBase64Image(image,(dataURL)=>{console.log(dataURL);});




    function setBlackname(data)
    {

        document.getElementById("picture").src=image2;
        // document.getElementById("picture").attr("src",data);
        document.getElementById("eee").innerText=data;
    }


    setBlackname(image);


    //js代码



</script>


<!--/storage/emulated/0/Android/data/com.example.haohao.test6/cache/output_image.jpg-->
<!--/storage/emulated/0/DCIM/1.jpg-->


<script>
    // get_company();
    // getBase64(image2);


</script>


</body>
</html>